/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __DDEBA1E4_A5BF_41CF_8D2C_0D2BC94F37F8__
#define __DDEBA1E4_A5BF_41CF_8D2C_0D2BC94F37F8__

#include "i_variant.h"

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace xos_box
{

    ///////////////////////////////////////////////////////////////////////////////////////////////////////
    // 
    // i_int_property
    // 
    class i_int_property : public xos::i_release
    {
    protected:
        virtual ~i_int_property(){}

    public:
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
        // method
        // 
        virtual const char * str( int nId, char * lpszValue = 0, int nBufSize = 0, int * lpnSizeNeeded = 0 ) = 0;
        virtual xos::i_release * obj( int nId, xos::i_release ** ppv = 0 ) = 0;
        virtual xos_box::i_list * list( int nId, xos_box::i_list ** ppv = 0 ) = 0;
        virtual i_int_property * int_prop( int nId, i_int_property ** ppv = 0 ) = 0;
        virtual i_str_property * str_prop( int nId, i_str_property ** ppv = 0 ) = 0;
        virtual v_create fun( int nId, v_create * pv = 0 ) = 0;
        virtual double dbl( int nId, double * lpdValue = 0 ) = 0;
        virtual float flt( int nId, float * lpfValue = 0 ) = 0;
        virtual int32_t i32( int nId, int32_t  * lpnValue = 0 ) = 0;

        virtual uint64_t * u64_ptr( int nId, uint64_t ** lppRet = 0 ) = 0;
        virtual int64_t * i64_ptr( int nId, int64_t ** lppRet = 0 ) = 0;
        virtual uint32_t * u32_ptr( int nId, uint32_t ** lppRet = 0 ) = 0;
        virtual int32_t * i32_ptr( int nId, int32_t ** lppRet = 0 ) = 0;
        virtual uint16_t * u16_ptr( int nId, uint16_t ** lppRet = 0 ) = 0;
        virtual int16_t * i16_ptr( int nId, int16_t ** lppRet = 0 ) = 0;
        virtual uint8_t * u8_ptr( int nId, uint8_t ** lppRet = 0 ) = 0;
        virtual int8_t * i8_ptr( int nId, int8_t ** lppRet = 0 ) = 0;
        virtual char * char_array( int nId, char ** lppRet = 0, int * lpnSize = 0, int * lpnLen = 0 ) = 0;
        virtual char * bin_ptr( int nId, char ** lppRet = 0, int * lpnSize = 0, int * lpnLen = 0 ) = 0;
        virtual double * dbl_ptr( int nId, double ** lppRet = 0 ) = 0;
        virtual float * flt_ptr( int nId, float ** lppRet = 0 ) = 0;
        virtual bool * bool_ptr( int nId, bool ** lppRet = 0 ) = 0;

        virtual int set( int nId, const char * lpszValue ) = 0;
        virtual int set_obj( int nId, xos::i_release * pv, bool bAutoRelease ) = 0;
        virtual int set_list( int nId, xos_box::i_list * pv, bool bAutoRelease ) = 0;
        virtual int set_int_prop( int nId, i_int_property * pv, bool bAutoRelease ) = 0;
        virtual int set_str_prop( int nId, i_str_property * pv, bool bAutoRelease ) = 0;
        virtual int set( int nId, i_variant * pv ) = 0;
        virtual int set( int nId, v_create pv ) = 0;
        virtual int set( int nId, double value ) = 0;
        virtual int set( int nId, float value ) = 0;
        virtual int set( int nId, int32_t value ) = 0;

        virtual int set( int nId, uint64_t * lpRef ) = 0;
        virtual int set( int nId, int64_t * lpRef ) = 0;
        virtual int set( int nId, uint32_t * lpRef ) = 0;
        virtual int set( int nId, int32_t * lpRef ) = 0;
        virtual int set( int nId, uint16_t * lpRef ) = 0;
        virtual int set( int nId, int16_t * lpRef ) = 0;
        virtual int set_u8( int nId, uint8_t * lpRef ) = 0;
        virtual int set_i8( int nId, int8_t * lpRef ) = 0;
        virtual int set_char_array( int nId, char * lpRef, int nBufSize ) = 0;
        virtual int set_bin( int nId, char * lpRef, int nBufSize ) = 0;
        virtual int set( int nId, double * lpRef ) = 0;
        virtual int set( int nId, float * lpRef ) = 0;
        virtual int set( int nId, bool * lpRef ) = 0;

        virtual i_variant * remove( int nId ) = 0;
        virtual i_variant * vt( int nId ) = 0;

        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
        // 遍历
        // 
        virtual i_variant * next( int * pnId ) = 0;
        virtual int reset() = 0;

        // 其它
        virtual int release_all() = 0;
        virtual int size() = 0;
    };

    ///////////////////////////////////////////////////////////////////////////////////////////////////////
    // 
    // property
    // 
    class i_str_property : public xos::i_release
    {
    protected:
        virtual ~i_str_property(){}

    public:
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
        // name index
        // 

        virtual const char * str( const char * lpszName, char * lpszValue = 0, int nBufSize = 0, int * lpnSizeNeeded = 0 ) = 0;
        virtual xos::i_release * obj( const char * lpszName, xos::i_release ** ppv = 0 ) = 0;
        virtual xos_box::i_list * list( const char * lpszName, xos_box::i_list ** ppv = 0 ) = 0;
        virtual i_int_property * int_prop( const char * lpszName, i_int_property ** ppv = 0 ) = 0;
        virtual i_str_property * str_prop( const char * lpszName, i_str_property ** ppv = 0 ) = 0;
        virtual v_create fun( const char * lpszName, v_create * pv = 0 ) = 0;
        virtual double dbl( const char * lpszName, double * lpdValue = 0 ) = 0;
        virtual float flt( const char * lpszName, float * lpfValue = 0 ) = 0;
        virtual int32_t i32( const char * lpszName, int32_t * lpnValue = 0 ) = 0;

        virtual uint64_t * u64_ptr( const char * lpszName, uint64_t ** lppRet = 0 ) = 0;
        virtual int64_t * i64_ptr( const char * lpszName, int64_t ** lppRet = 0 ) = 0;
        virtual uint32_t * u32_ptr( const char * lpszName, uint32_t ** lppRet = 0 ) = 0;
        virtual int32_t * i32_ptr( const char * lpszName, int32_t ** lppRet = 0 ) = 0;
        virtual uint16_t * u16_ptr( const char * lpszName, uint16_t ** lppRet = 0 ) = 0;
        virtual int16_t * i16_ptr( const char * lpszName, int16_t ** lppRet = 0 ) = 0;
        virtual uint8_t * u8_ptr( const char * lpszName, uint8_t ** lppRet = 0 ) = 0;
        virtual int8_t * i8_ptr( const char * lpszName, int8_t ** lppRet = 0 ) = 0;
        virtual char * char_array( const char * lpszName, char ** lppRet = 0, int * lpnSize = 0, int * lpnLen = 0 ) = 0;
        virtual char * bin_ptr( const char * lpszName, char ** lppRet = 0, int * lpnSize = 0, int * lpnLen = 0 ) = 0;
        virtual double * dbl_ptr( const char * lpszName, double ** lppRet = 0 ) = 0;
        virtual float * flt_ptr( const char * lpszName, float ** lppRet = 0 ) = 0;
        virtual bool * bool_ptr( const char * lpszName, bool ** lppRet = 0 ) = 0;

        virtual int set( const char * lpszName, const char * lpszValue ) = 0;
        virtual int set_obj( const char * lpszName, xos::i_release * pv, bool bAutoRelease ) = 0;
        virtual int set_list( const char * lpszName, xos_box::i_list * pv, bool bAutoRelease ) = 0;
        virtual int set_int_prop( const char * lpszName, i_int_property * pv, bool bAutoRelease ) = 0;
        virtual int set_str_prop( const char * lpszName, i_str_property * pv, bool bAutoRelease ) = 0;
        virtual int set( const char * lpszName, i_variant * pv ) = 0;
        virtual int set( const char * lpszName, v_create pv ) = 0;
        virtual int set( const char * lpszName, double value ) = 0;
        virtual int set( const char * lpszName, float value ) = 0;
        virtual int set( const char * lpszName, int32_t value ) = 0;

        virtual int set( const char * lpszName, uint64_t * lpRef ) = 0;
        virtual int set( const char * lpszName, int64_t * lpRef ) = 0;
        virtual int set( const char * lpszName, uint32_t * lpRef ) = 0;
        virtual int set( const char * lpszName, int32_t * lpRef ) = 0;
        virtual int set( const char * lpszName, uint16_t * lpRef ) = 0;
        virtual int set( const char * lpszName, int16_t * lpRef ) = 0;
        virtual int set_u8( const char * lpszName, uint8_t * lpRef ) = 0;
        virtual int set_i8( const char * lpszName, int8_t * lpRef ) = 0;
        virtual int set_char_array( const char * lpszName, char * lpRef, int nBufSize ) = 0;
        virtual int set_bin( const char * lpszName, char * lpRef, int nBufSize ) = 0;
        virtual int set( const char * lpszName, double * lpRef ) = 0;
        virtual int set( const char * lpszName, float * lpRef ) = 0;
        virtual int set( const char * lpszName, bool * lpRef ) = 0;

        virtual i_variant * remove( const char * lpszName ) = 0;
        virtual i_variant * vt( const char * lpszName ) = 0;

        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
        // other helper function
        // 

        virtual i_variant * next( const char ** ppKey, char * lpszKey, int nBufSize, int * lpnSizeNeeded ) = 0;
        virtual int reset() = 0;

        virtual int release_all() = 0;
        virtual int size() = 0;
    };

} // xos_box

#endif // __DDEBA1E4_A5BF_41CF_8D2C_0D2BC94F37F8__
